package com.bwie.controller;

import com.bwie.service.UserService;
import com.bwie.utils.R;
import com.bwie.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author lenovo
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/sendCode/{mobile}")
    public R sendCode(@PathVariable String mobile){
        return userService.sendCode(mobile);
    }
    /**
     * @description:验证码登录
     * @author: sxting~😊
     * @Date: 2024/9/3 21:18
     * @param:
     * @param userVo
     * @return: com.bwie.utils.R
     **/
    @PostMapping("/codeLogin")
    public R codeLogin(@RequestBody UserVo userVo){
        return userService.codeLogin(userVo);
    }
   /**
     * @description: 找回密码
     * @author: sxting~😊
     * @Date: 2024/9/3 21:18
     * @param:
     * @param userVo
     * @return: com.bwie.utils.R
     **/
    @PostMapping("/findPassword")
    public R findPassword(@RequestBody UserVo userVo){
        return userService.findPassword(userVo);
    }



    /**
     * @description:用户密码登录
     * @author: sxting~😊
     * @Date: 2024/9/3 21:16
     * @param:
     * @param userVo
     * @return: com.bwie.utils.R
    **/
    @PostMapping("/login")
    public R login(@RequestBody UserVo userVo){
        return userService.login(userVo);
    }


    @PostMapping("/updatePassword")
    public R updatePassword(@RequestBody UserVo userVo){

       return userService.updatePassword(userVo);
    }


}
